FIG. 1 illustrates a conventional network processor system. The system includes a network processor 102 executing an operating system (OS) 108, and one or more state based applications 104 executed by the OS 108. In conventional message processing systems, ingress messages 106 are categorized into classes based on what they accomplish and/or their priority. At any given time, an application 104 may be interested in an ingress message 106, based on the class in which the message 106 belongs and the current state of the application 104.
After the applications 104 are powered on, they eventually reach a state where they are ready and able to receive operational messages. One conventional approach in processing ingress messages is to use a single message queue for all messages. As each message is dequeued, the application 104 “wakes”, after which it determines if it is interested in the message 106 from the queue. If so, then the message 106 is processed by the application 104. If not, the message 106 is either dropped or deferred by putting it back in the queue. However, with this approach, the application 104 wakes each time a message 106 is received, even if the application 104 is not interested in the message. This approach is thus inefficient and results in the slow execution of the application 104. In addition, not all network processors have the defer capability. Even when it is available, messages of the same class can be processed out of order. A single message queue also may not be able to supply the number of priority levels needed by the application 104.
Another conventional approach is to use one message queue per class and for the application 104 to wait on the appropriate queue. This approach is efficient only if the application 104 is interested in just one message class and blocks on the corresponding queue. However, when the application 104 wishes to receive more than one class of messages, the application 104 will only see class of messages from the queue at which it is blocking, and will not see any of the messages from the other classes of messages at other queues. One technique is to poll for available messages. At regular intervals, the application 104 checks for a message in each queue in which it is interested. However, this approach has an inherent latency since pending messages will not be detected until the next poll cycle. In addition, polling creates overhead for the network processor 102, even when there are no messages in the interested queues. This approach is thus inefficient and results in the slow execution of the application 104.
Accordingly, there exists a need for a more efficient method for performing state based ingress packet selection for a packet processing system in a network processor. The present invention addresses such a need.